var e = require;
var t = module;
var o = exports;
var Adv_skd=require("./Adv_skd");
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("GlobalParams"),
    a = e("AssetsManager"),
    i = e("ModuleUI"),
    r = e("CommonHelper"),
    s = e("nameCfg"),
    l = e("AD"),
    c = cc._decorator,
    d = c.ccclass,
    h = c.property,
    _ = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (t.player_name_label = null), (t.player_head_sprite = null), (t.player_level_sprite = null), t;
        }
        return (
            __extends(t, e),

            (t.prototype.onDisable = function () {

                Adv_skd.default.instance.hideBannerAd();
                Adv_skd.default.instance.hideGridAdLeft();
                Adv_skd.default.instance.hideGridAdRight();
                Adv_skd.default.instance.hideGridAdTop();
                Adv_skd.default.instance.hideGridAdLeftOne();
                Adv_skd.default.instance.hideGridAdRightOne();
                Adv_skd.default.instance.hideGridAdButtom();

            }),

            (t.prototype.initView = function () {

                Adv_skd.default.instance.hideBannerAd();
                Adv_skd.default.instance.hideGridAdLeft();
                Adv_skd.default.instance.hideGridAdRight();
                Adv_skd.default.instance.hideGridAdTop();
                Adv_skd.default.instance.hideGridAdLeftOne();
                Adv_skd.default.instance.hideGridAdRightOne();
                Adv_skd.default.instance.hideGridAdButtom();
                Adv_skd.default.instance.showGridAdLeft();
                Adv_skd.default.instance.showGridAdRight();
                Adv_skd.default.instance.showGridAdTop();
                Adv_skd.default.instance.showBannerAd();

                e.prototype.initView.call(this), this.showMatchInfo();
            }),
            (t.prototype.OnClick = function (t) {
                switch ((e.prototype.OnClick.call(this, t), t.node.name)) {
                    case "consent_btn":
                        (n.GlobalParams.ChangeGameMode = 1),
                            (n.GlobalParams.MathcTimeInfo.open = !1),
                            (n.GlobalParams.MathcTimeInfo.time = 180),
                            (n.GlobalParams.ChangeGameMode = 1),
                            this.uiManager.showPopup("MatchViewUI"),
                            this.node.destroy();
                        break;
                    case "refuse_btn":
                    case "back_btn":
                        (n.GlobalParams.MathcTimeInfo.time = 180),
                            (n.GlobalParams.MathcTimeInfo.open = !0),
                            this.node.destroy();
                }
            }),
            (t.prototype.showMatchInfo = function () {
                n.GlobalParams.gameShock.value && l.default.getInstance().vibrateShort(),
                    (n.GlobalParams.MathcTimeInfo.open = !1);
                var e = n.GlobalParams.PlayerInfo.value,
                    t = "";
                do {
                    t = s.default.nameList[r.default.getRandomInt(0, s.default.nameList.length - 1)];
                } while (t == e.name);
                var o = r.default.getRandomInt(1, 19);
                (n.GlobalParams.MathcTimeInfo.name = t),
                    (n.GlobalParams.MathcTimeInfo.head = o),
                    (this.player_name_label.string = t),
                    (this.player_head_sprite.spriteFrame = a.default.getInstance().getPlayerHeadFrame(o));
                var i = e.level + r.default.getRandomInt(-2, 2);
                this.player_level_sprite.spriteFrame = a.default
                    .getInstance()
                    .getPlayerLevelExp(i > 28 ? 28 : i < 1 ? 1 : i);
            }),
            __decorate([h(cc.Label)], t.prototype, "player_name_label", void 0),
            __decorate([h(cc.Sprite)], t.prototype, "player_head_sprite", void 0),
            __decorate([h(cc.Sprite)], t.prototype, "player_level_sprite", void 0),
            __decorate([d], t)
        );
    })(i.default);
o.default = _;
